<template>
  <div>
    <criteria-paged :model="model"  v-ref:paged>
      <criteria partial='criteria' @condition-changed='search' v-ref:criteria>
        <table partial>
          <tr>
            <td><label for="f_residential_area">小区:</label></td>
            <td>
              <!-- 小区: -->
              <input type="text" class="form-control" v-model="model.f_residential_area" id="f_residential_area"
              placeholder='小区' condition="f_residential_area like '{}%'">
            </td>
            <td><label for="f_address">地址:</label></td>
            <td>
              <!-- 地址: -->
              <input type="text" class="form-control" v-model="model.f_address" id="f_address"
              placeholder='地址' condition="f_address like '{}%'">
            </td>
          </tr>
          <tr>
            <td><label for="f_keyin">是否录入：</label></td>
            <td>
              <v-select id="f_keyin"
              placeholder='是否录入'
              :value.sync="$parent.$parent.model.f_sign"
              :options='$parent.$parent.signs'
              close-on-select clear-button></v-select>
            </td>
            <td><label for="f_user_state">档案状态：</label></td>
            <td>
              <v-select id="f_user_state"   placeholder='档案状态'
              :value.sync="$parent.$parent.model.f_user_state"
              :options='$parent.$parent.f_user_states'
              close-on-select clear-button></v-select>
            </td>
          </tr>
          <tr>
            <td><label for="f_inputdate">录入日期：</label></td>
            <td>

              <input type="date" class="form-control" v-model="model.f_inputdate" id="f_inputdate"
              condition="substring(f_inputdate,1,10) = '{}'">
            </td>
            <td></td>
            <td>
              <!-- <chooser :userid.sync='$parent.$parent.$parent.f.id' resource-type="user" :width='300' :select-data.sync='$parent.$parent.model.chosenOrg'></chooser> -->
              <button type="button" class="btn btn-success" @click="search()">
                 <span class="glyphicon glyphicon-search">查询</span>
              </button>
            </td>
          </tr>
        </table>
      </criteria>
      <data-grid :model="model" partial="list" v-ref:grid>
        <template partial='head'>
          <tr>
            <th>用户名</th>
            <th>小区名称</th>
            <th>地址</th>
            <th>最后安检日期</th>
            <th>最后安检状态</th>
          </tr>
        </template>
        <template partial='body'>
          <td>{{row.f_user_name}}</td>
          <td>{{row.f_residential_area}}</td>
          <td>{{row.f_address}}</td>
          <td>{{row.f_last_check_date}}</td>
          <td>{{row.f_last_check_state}}</td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>

<script>
import { PagedList } from 'vue-client'
import Vue from 'vue'
import AppData from '../../stores/AppData'
export default {
  title: '安检员B',
  data () {
    let model = new PagedList('rs/sql/根据安检员查询用户档案', 20, { items: '"*"', tablename: '"t_userfiles"', groupitem: '""', orderitem: '"f_residential_area"',
    f_checker_id: 'this.chosenOrg.id', f_subcompany: 'this.f_subcompany', f_sign: 'this.f_sign[0]', f_state: 'this.f_user_state[0]'})
    model.f_sign = ['']
    model.f_user_state = ['']
    return {
      model: model,
      signs: [
        {label: '请选择档案状态', value: ''},
        {label: '录入', value: '1'},
        {label: '非录入', value: '0'}
      ]
      // f_user_states: this.$getParams('用户正常档案状态', [{label:'请选择用户档案状态',value:''}])
    }
  },
  ready () {
    this.model.chosenOrg = {id: 0}
    this.model.f_subcompany = Vue.f_subcompany
  },
  computed: {
    f_user_states () {
      return [{label: '全部', value: ''}, ...AppData.getParam('档案状态')]
    }
  }
}
</script>
